<div class="page-header">
    <h1>
        艺人结算统计列表
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
            查看艺人结算统计信息；
        </small>
    </h1>
</div>
<div class="row">
    <div class="col-xs-12">
        <table id="dtpList" class="dataTable">
        </table>
        <div id="dtpList_filter" class="dataTables_filter">
            <div>

                <select id="dtpList_F_SType" class="selectpicker" data-style="btn btn-info btn-sm" data-width="90px">
                    <option value="">模糊查询</option>
                    <option data-divider="true"></option>
                    <option value="NickName">用户昵称</option>
                    <option value="User_ID">用户ID</option>
                    <option value="Family_ID">公会ID</option>
                </select>
                <input id="dtpList_F_SValue" class="fvalue" type="text"/>
                <label>时间：</label>
                <input id="dtpList_F_StartDate" type="text" style="width: 76px;" placeholder="开始时间">
                <label>-</label>
                <input id="dtpList_F_EndDate" type="text" style="width: 76px;" placeholder="结束时间">
                <button id="dtpList_F_Btn"></button>
                <button type="button" id="Anchor_Stat_Excel" name="dtpList_F_Export" RightCode="{Routine}[Order](Export)" class="btn btn-xs btn-success">
                    <i class="ace-icon fa fa-file-excel-o"></i> 导出
                </button>
            </div>
        </div>
    </div>
</div>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.min.js"></script>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.bootstrap.min.js"></script>
<script>
    $(function () {
        //////////////////////////////////////////////////////////
        //时间输入框插件
        //////////////////////////////////////////////////////////
        $('#dtpList_F_StartDate , #dtpList_F_EndDate').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true
        });
        //////////////////////////////////////////////////////////
        //绑定日期选择框
        //////////////////////////////////////////////////////////
        $.KOC.Date.Select.Bind({
            eSelect: $('#dtpList_F_SelectDate'),
            eBegin: $('#dtpList_F_StartDate'),
            eEnd: $('#dtpList_F_EndDate')
        });
//        //导出数据
//        $("#Anchor_Stat_Excel").click(function(){
//            var data = {
//                F_SType : $('#dtpList_F_SType').val(),
//                F_SValue : $('#dtpList_F_SValue').val(),
//                F_StartDate : $('#dtpList_F_StartDate').val(),
//                F_EndDate : $('#dtpList_F_EndDate').val()
//            };
//            var url =  "list/excel?F_SType=" + data.F_SType+
//                    "&F_SValue=" + data.F_SValue +
//                    "&F_StartDate=" + data.F_StartDate +
//                    "&F_EndDate=" + data.F_EndDate;
//            window.open(url);
//        });
        //列表数据(分页)
        var _dtpList = $("#dtpList").dataTable({
            //列信息
            'aoColumns': [
                {
                    'sWidth': '20px', 'data': 'User_ID', 'sName': 'User_ID', 'sTitle': '用户ID', 'sClass': 'center',
                },
                {
                    'sWidth': '20px', 'data': 'Family_ID', 'sName': 'Family_ID', 'sTitle': '公会ID', 'sClass': 'center',
                },
                {
                    'sWidth': '30px', 'data': 'NickName', 'sName': 'NickName', 'sTitle': '昵称', 'bSortable': false, 'sClass': 'center'
                },
                {
                    'sWidth': '30px', 'data': 'Sum_Efftive', 'sName': 'Sum_Efftive', 'sTitle': '直播有效天', 'bSortable': false, 'sClass': 'center'
                },
                {
                    'sWidth': '30px', 'data': 'Sum_LiveDuring', 'sName': 'Sum_LiveDuring', 'sTitle': '累计时长', 'bSortable': false, 'sClass': 'center'
                },
                {
                    'sWidth': '30px', 'data': 'Sum_BeansAnchor', 'sName': 'Sum_BeansAnchor', 'sTitle': '金豆收入', 'bSortable': false, 'sClass': 'center'
                },
                {
                    "sWidth": "30px", 'data': 'User_ID', "sTitle": "操作", "sClass": "center", 'bSortable': false,
                    "createdCell": function (td, cellData, rowData) {
                        $(td).html('<a href="/statistics-manage/demographics-manage/dayanchorlist" target="_blank">明细</a>');
                    }
                }
            ],
            'aaSorting': [0, 'desc'],
            'sAjaxSource': '/ajax/user.user-anchor.pageanchorstatistics',
            'fnServerParams': function (aoData) {
                if (!this.arrPageFilter) {
                    //搜索:条件发生变化
                    this.arrPageFilter = [];
                    this.arrPageFilter.push(
                            {'name': 'F_StartDate', 'value': $(this.selector + '_F_StartDate').val()},
                            {'name': 'F_EndDate', 'value': $(this.selector + '_F_EndDate').val()}
                    );
                }
                else {
                    //重置条件框内容：未按搜索按钮
                    $(this.selector + '_F_StartDate').val(this.arrPageFilter[0].value);
                    $(this.selector + '_F_EndDate').val(this.arrPageFilter[1].value);
                }
                this.ofnServerParams(aoData);
            }
        });
        $("#Anchor_Stat_Excel").click(function(){
            var data = {
                F_SValue: $('#dtpList_F_SValue').val(),
                F_StartDate: $('#dtpList_F_StartDate').val(),
                F_EndDate: $('#dtpList_F_EndDate').val()
            }
            window.open("/finance-manage/anchorstat-manage/list/excel?F_SValue=" + data.F_SValue + "&F_StartDate=" + data.F_StartDate + "&F_EndDate=" + data.F_EndDate + "", "_blank");

        });
    });
</script>